package com.jctrip.hotel.route.common;

import com.jctrip.hotel.domain.entity.HtRouteInfo;
import lombok.Builder;
import lombok.Data;

/**
 * 渠道接口3.0 渠道缓存
 */
public class ThreadLocalSession {

    private static final ThreadLocal<RequestSession> LOCAL = new ThreadLocal<>();

    public static void put(RequestSession requestSession) {
        LOCAL.set(requestSession);
    }

    public static RequestSession get() {
        return LOCAL.get();
    }

    public static void clear() {
        LOCAL.remove();
    }
    /**
     * 请求缓存信息
     */
    @Data
    @Builder
    public static class RequestSession {

        /**
         * 渠道信息
         */
        private HtRouteInfo routeInfo;
    }
}
